package com.niiwoo.civet.trade.dto.request.loan;

import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @Author: wuke
 * @Description:
 * @Date: Created in 17:40 2018/4/13
 */
@Data
public class LoanSubmitReqDTO extends LoanSubmitCommReqDTO {
    @NotNull(message = "借款金额不能为空")
    @DecimalMin(value="0",message = "借款金额不能小于0")
    private BigDecimal loanAmount;

    @NotNull(message = "借款期限不能为空")
    private Integer deadline;

    @NotNull(message = "借款标题不能为空")
    private String loanTitle;

    // 使用红包Id
    private Long prizeId;

    // 使用红包类型
    private Byte prizeType;

    @NotNull(message = "通讯录不能为空")
    @Size(min = 1,message = "通讯录不能为空")
    private List<AddressInfoDTO> addressInfoList;

    @Valid
    @NotNull(message = "借款设备信息不能为空")
    private DeviceInfoRequestDTO deviceInfo;

    @Data
    public static class AddressInfoDTO implements Serializable {
        private static final long serialVersionUID = 4784435484594288417L;

        // 手机号码
        private String mobile;

        // 联系人姓名
        private String remark;
    }

    @Data
    public static class DeviceInfoRequestDTO implements Serializable {
        private static final long serialVersionUID = 5629712661199077048L;

        @NotNull(message = "设备ID不能为空")
        private String  deviceId;

        @Pattern(regexp="Android|iOS",message="操作系统类型错误")
        private String  os;

        // 品牌类型
        private String  brandType;

        // 是否双卡双待（0：否   1：是）
        private Byte    dsds;

        // 设备状态（0：未越狱  1：已越狱）
        private Byte    deviceStatus;

        // 借款时GPS
        private String  gps;

        // 借款时IP
        private String  ip;

        // 借款时网络类型
        private String  network;

        // WiFi的SSID
        private String  wifiSsid;

        // 地图类型（0-高德 1-百度）
        private Byte mapType;

        // 设备指纹信息
        private String blackBox;
    }
}
